(function($) {
	
    var init={
    		"bFilter": true,// 搜索框
    		"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 2 ] }], 
    		"aoColumns" : [
    		               {"data":"mainTitle"
//    		            	   "render": function(data, type, full) {
//                                 return '<div onmouseover="spanshow(this)" onmouseout="spanhide(this)"><span name="deleteOrEdit" class="pull-right" style="display:none"><a href="/forms/delete/'+full.id+'"><i class="fa fa-trash-o m-l-sm"></i></a><a ui-sref="app.lpadd"  href="/forms/update/'+full.id+'"><i class="fa fa-pencil-square-o m-l-sm"></i></a></span>'+data+'<div>';
//    		            	  } 
    		               
    		               },
                           {"data" : "createdAt",
                        	"render":function(data,type,full){
                        		   return formatDate(new Date(data));// 时间格式化
                        	   }
                           },
                           {"data":"id",
                        	   "render": function(data, type, full) {
                        		   //添加权限 ：当代运营的各户自己登陆所看到的
                        		   if(operationType==1&&!isFromBackend){
                        			   return '<div ><span name="deleteOrEdit" class="" ><a href="/forms/datail/'+full.id+'">预览<i class="m-l-sm"></i></a></span><div>';
                        			}
                        		   
                                   return '<div ><span name="deleteOrEdit" class="" ><a href="/forms/datail/'+full.id+'">预览<i class="m-l-sm"></i></a><a   href="/forms/update/'+full.id+'">编辑<i class=" m-l-sm"></i></a><a href="/forms/delete/'+full.id+'">删除<i class="m-l-sm"></i></a></span><div>';
      		            	  }    
                           }
                       ],
                order:[
                       [1,"desc"]
                       ],
             "sAjaxSource": "/forms",// 这个是请求的地址
    }
    $(function(){ 
        $.extend(init,dataTableInit)
        $("#flowTable").dataTable(init);
    })
    
  // 在表单外自定义搜索框
    $("#button").on( 'click ', function () {
    		//
    	  $("#flowTable").DataTable().column( 0 ).search(
    		     $('#startDate').val()
    		    );// 保存信息
    	  $("#flowTable").DataTable().column( 1 ).search(
  		        $('#endDate').val()
  		    ).draw();// 保存信息并发起请求
    } );
})($);